package com.atguigu.create.singleton.type8;

/**
 * 单例模式-枚举
 */
public class SingletonTest8 {
    public static void main(String[] args) {
        Singleton instance = Singleton.INSTANCE;
        Singleton instance2 = Singleton.INSTANCE;
        System.out.println(instance==instance2);
        instance.sayHello();
    }
}

enum Singleton{
    INSTANCE;

    public void sayHello(){
        System.out.println("hello");
    }
}
